home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Biodiversity of Illinois 2: Woodland Habitats
/
Biodiversity of Illinois 2 - Woodland Habitats.iso
/
mac
/
casts
/
PDFxtraBehaviors.cst
/
00015_Script_PDF_ScrollTo
< prev
next >
Wrap
Text File
|
2006-07-11
|
4KB
|
120 lines
-- Scroll To
Property pEvent, pSprite, pZoom, pScale, pX, pY, pAlertFlag
on doScrollTo me
case pZoom of:
"Fit Width": set m = #fitWidth
"Actual Size": set m = #actualSize
"Fit Page": set m = #fitPage
"Fit Visible": set m = #fitVisible
-- "None (Acrobat/Win only)": set m = #none
otherwise:
if (pScale<8) or (pScale>1600) then
alert "Invalid zoom value"
exit
else
set m = #useScale
end if
end case
set err = PDF_ScrollTo(sprite pSprite, m, pScale, pX, pY)
if PDF_status(sprite pSprite) then alert "PDF Behavior Error"&RETURN&PDF_error(sprite pSprite)
end doScrollTo
on mouseUp me
if (pEvent = #mouseUp) then doScrollTo(me)
end mouseUp
on mouseDown me
if (pEvent = #mouseDown) then doScrollTo(me)
end mouseDown
on prepareFrame me
if (pEvent = #prepareFrame) then doScrollTo(me)
end prepareFrame
-- standard behavior stuff --
on getPropertyDescriptionList me
set defaultValues = GetDefaultValues (me)
set pdfSpriteList = getProp (defaultValues, #spriteList)
set defSprite = getProp (defaultValues, #defaultSprite)
if (defSprite=0) then
if the ticks - pAlertFlag > 10 then
alert "Please create a sprite of type PDF first."
end if
set pAlertFlag = the ticks -- The ticks when the user clicked "OK"
exit
end if
set p_list = [:]
addprop p_list, #pEvent, [ #comment: "Event", #format:#symbol, #range:[#mouseUp, #mouseDown, #prepareFrame], #default:#mouseUp]
addprop p_list, #pSprite, [ #comment: "PDF Sprite is in channel:", #format:#symbol, #range:pdfSpriteList, #default:defSprite]
addprop p_list, #pZoom, [ #comment: "Zoom to:", #format:#symbol, #range:["Fit Width", "Actual Size", "Fit Page", "Fit Visible", "Other (specify below)"], #default:"Fit Width"]
addprop p_list, #pScale, [ #comment: "Other (8..1600):", #format:#integer, #default:""]
addprop p_list, #pX, [ #comment: "Scroll H:", #format:#integer, #default:0]
addprop p_list, #pY, [ #comment: "Scroll V:", #format:#integer, #default:0]
return p_list
end
on getBehaviorDescription
tmp = "Scroll PDF document to the specified Horizontal/Vertical pixel position within the sprite." &RETURN& "Available for Windows Only."
tmp = tmp &RETURN&RETURN& "--- PARAMETERS ---"
tmp = tmp &RETURN& " - Event: mouseUp, mouseDown, or prepareFrame"
tmp = tmp &RETURN& " - Sprite is in channel: which channel contains the PDF Sprite"
tmp = tmp & RETURN& " - Zoom to: FitWidth, Actual Size, Fit Page, Fit Visible, Other."
tmp = tmp & RETURN& " - Other zoom (8..1600): A number representing the percentage to scale the document."
tmp = tmp & RETURN& " - Scroll H: Set the horizontal scroll position to the number of pixels specified."
tmp = tmp & RETURN& " - Scroll V: Set the vertical scroll position to the number of pixels specified."
tmp = tmp &RETURN&RETURN& "Free to use and abuse. (c)1999 - 2005, Integration New Media, Inc." &RETURN& "Thanks to James Newton for his suggestions"
return tmp
end
on getBehaviorTooltip
return "Scroll PDF document to the specified Horizontal/Vertical" & RETURN& "pixel position within the sprite." &RETURN& "Available for Windows Only."
end
-- utils --
on GetDefaultValues me
if the currentSpriteNum then
set spriteList = GetSpriteList (me #PDF)
if count (spriteList) then
set defaultSprite = getAt (spriteList, 1)
else
set defaultSprite = 0
end if
return [#spriteList: spriteList, #defaultSprite: defaultSprite]
else -- the currentSpriteNum = 0
-- Director is merely recompiling this script: return dummy values
return [#spriteList: [1], #defaultSprite: 1]
end if
end
on GetSpriteList me, memberType
-- return list of sprites of type memberType in current frame
global version
if (char 1 of version = 6) then
set maxSprite = 120
else
set maxSprite = the lastChannel
end if
set aList=[]
repeat with i = 1 to maxSprite
set spriteMember = the member of sprite i
-- if (string(m) contains "member 0") then next repeat -- unnecessary
if (the type of spriteMember = memberType) then -- (JN) Line break
append (aList, i)
end if
end repeat
return aList
end GetSpriteList